﻿using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;

namespace TTprotons.Crm.JavascriptAudit.Common
{
    public class CustomizationExportManager
    {
        public ExportCompressedXmlResponse Export(ICrmService crmService, string entityName)
        {
            var exportZipRequest = new ExportCompressedXmlRequest
            {
                EmbeddedFileName = Constants.CrmCustomizationFileName,
                ParameterXml = string.Format(Constants.CrmExportParameterByEntityName, entityName)
            };

            return (ExportCompressedXmlResponse)crmService.Execute(exportZipRequest);
        }
    }
}